<div class="form__wrapper">
  <div class="card" data-controller="accordion" id="accordion-title">
    <div class="card-divider">
      <button class="card-divider-button" data-open="true" data-controls="panel-title" type="button">
        <%= icon "arrow-right-s-line" %>
        <h2 class="card-title" id="title">
          <%= t("initiatives.form.title", scope: "decidim.initiatives.admin") %>
        </h2>
      </button>
    </div>

    <div id="panel-title" class="card-section">
      <div class="row column">
        <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
      </div>

      <div class="row column">
        <%= form.translated :editor, :description, aria: { label: :description } %>
      </div>

      <div class="row">
        <div class="columns">
          <%= form.upload :banner_image, button_class: "button button__sm button__transparent-secondary" %>
        </div>
      </div>
    </div>
  </div>

  <div class="card" data-controller="accordion" id="accordion-options">
    <div class="card-divider">
      <button class="card-divider-button" data-open="true" data-controls="panel-options" type="button">
        <%= icon "arrow-right-s-line" %>
        <h2 class="card-title" id="options">
          <%= t("initiatives_types.form.options", scope: "decidim.initiatives.admin") %>
        </h2>
      </button>
    </div>

    <div id="panel-options" class="card-section">
      <div class="row column">
        <%= form.select :signature_type, form.object.signature_type_options %>
      </div>

      <div class="row column">
        <%= form.check_box :attachments_enabled %>
      </div>

      <div class="row column">
        <%= form.check_box :undo_online_signatures_enabled %>
      </div>

      <div class="row column">
        <%= form.check_box :custom_signature_end_date_enabled %>
      </div>

      <div class="row column">
        <%= form.check_box :area_enabled %>
      </div>

      <div class="row column">
        <%= form.check_box :child_scope_threshold_enabled, help_text: t(".child_scope_threshold_enabled_help_html") %>
      </div>

      <div class="row column">
        <%= form.check_box :only_global_scope_enabled, help_text: t(".only_global_scope_enabled_help_html") %>
      </div>

      <div id="promoting-committee-details">
        <div class="row column">
          <%= form.check_box :promoting_committee_enabled %>
        </div>

        <div class="row column minimum-committee-members-details">
          <%= form.number_field :minimum_committee_members, min: 0, step: 1 %>
        </div>
      </div>

      <div class="row column">
        <%= form.check_box :comments_enabled %>
      </div>
    </div>
  </div>

  <div class="card" data-controller="accordion" id="accordion-signature-workflow">
    <div class="card-divider">
      <button class="card-divider-button" data-open="true" data-controls="panel-signature-workflow" type="button">
        <%= icon "arrow-right-s-line" %>
        <h2 class="card-title" id="signature-workflow">
          <%= t("initiatives_types.form.signature_workflow_settings", scope: "decidim.initiatives.admin") %>
        </h2>
      </button>
    </div>

    <div id="panel-signature-workflow" class="card-section">
      <div class="row column">
        <%=
          form.select(
            :document_number_authorization_handler,
            Decidim::Initiatives::Signatures.workflows.map do |workflow|
              [t("#{workflow.name}.name", scope: "decidim.initiatives.signatures.workflows"), workflow.name]
            end,
            include_blank: true
          )
        %>
      </div>

      <div class="row column">
        <%= form.translated :editor, :extra_fields_legal_information, aria: { label: :extra_fields_legal_information } %>
      </div>
    </div>
  </div>

  <%= append_javascript_pack_tag "decidim_initiatives_admin" %>
</div>
